package disjunction.extensions.view
{
	import disjunction.core.*;
	import disjunction.core.geom.Vector2;
	
	import flash.display.DisplayObject;
	import flash.geom.Rectangle;

	/**
	 * Wraps DisplayObject for generic access by cameras and renderers.
	 *
	 * @author Nick Wiggill
	 */
	
	public class DisplayObjectEntity2D implements IEntity2D
	{
		public var displayObject:DisplayObject;
		private var _model:*;
		
		public function get model():*
		{
			return _model;
		}
		
		public function set model(value:*):void
		{
			_model = value;
		}
		/*
		public function DisplayObjectEntity2D(model:*, displayObject:DisplayObject)
		{
			super(model);
			this.displayObject = displayObject;
		}
		*/
		
		public function get position():Vector2
		{
			return new Vector2(displayObject.x, displayObject.y);
		}
		
		public function set position(value:Vector2):void
		{
			displayObject.x = value.x;
			displayObject.y = value.y;
		}
		
		public function get scale():Vector2
		{
			return new Vector2(displayObject.scaleX, displayObject.scaleY);
		}
		
		public function set scale(value:Vector2):void
		{
			displayObject.scaleX = value.x;
			displayObject.scaleY = value.y;
		}
		
		public function get rotation():Number
		{
			return displayObject.rotation;
		}
		public function set rotation(value:Number):void
		{
			displayObject.rotation = value;
		}
		
		public function get bounds():Rectangle
		{
			return displayObject.getBounds(displayObject.parent);
		}

	}
}